package com.woniu.market_stall_web.mapper;

import com.woniu.market_stall_web.entity.User;
import com.woniu.market_stall_web.vo.UserVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(User record);

    User selectByPrimaryKey(Integer id);

    List<User> selectAll();

    int updateByPrimaryKey(User record);

    @Select("select * from p_user where username = #{name}")
    User selectUserByName(String name);

    @Select("select count(*) from p_user where username = #{username}")
    int selectCountByName(String username);

    /**
     * 检验username和email是否存在
     * @param user
     * @return
     */
    User selectUserByUsernameAndEmail(User user);

    void updateUser(UserVo userVo);


}